<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>document</title>
    <style>
        table,
        td,
        th {
            border: 1px solid;
            border-collapse: collapse;
            text-align: center;
        }
    </style>
</head>

<body>
    <table>
        <tbody>
            <tr>
                <th>编号</th>
                <th>商品</th>
                <th>单价</th>
                <th>操作</th>
                <th>总价</th>
            </tr>
            <tr>
                <td>1</td>
                <td>草莓丸奶</td>
                <td>15</td>
                <td>
                    <input type="button" value="-">
                    <span>0</span>
                    <input type="button" value="+">
                </td>
                <td>0</td>
            </tr>
            <tr>
                <td>2</td>
                <td>榛子拿铁</td>
                <td>35</td>
                <td>
                    <input type="button" value="-">
                    <span>1</span>
                    <input type="button" value="+">
                </td>
                <td>35</td>
            </tr>
            <tr>
                <td>3</td>
                <td>草莓啵啵橙橙</td>
                <td>15</td>
                <td>
                    <input type="button" value="-">
                    <span>1</span>
                    <input type="button" value="+">
                </td>
                <td>15</td>
            </tr>
        </tbody>
    </table>
    <script>
        let tbody = document.querySelector("tbody");
        tbody.onclick = function (event) {
            // 如果点击的是 + 号
            if (event.target.value == '+') {
                event.target.previousElementSibling.innerText++;
                // 找单价
                let price = parseInt(event.target.parentElement.previousElementSibling.innerText);
                let count = parseInt(event.target.previousElementSibling.innerText);

                let money = price * count;

                event.target.parentElement.nextElementSibling.innerText = money;
                console.log(event.target.parentElement.nextElementSibling);

            }
        }
    </script>
</body>

</html>